package com.echo.week02.classLoader;

import java.lang.reflect.Method;

/**
 * @Author echo
 * @Description
 * @Date 2023/9/24.
 * @Version 1.0
 */
public class TestCustomClassLoader {
    public static void main(String[] args) throws Exception {
        HeroClassLoader heroClassLoader = new HeroClassLoader("D:\\person\\geekbang\\git\\geekbang\\practice\\week02\\lib");
        Class<?> heroClass = heroClassLoader.loadClass("com.java.classLoader.Test");
        if (heroClass!=null){
            Object o = heroClass.newInstance();
            Method say = heroClass.getMethod("say", null);
            say.invoke(o,null);
            System.out.println(heroClass.getClassLoader().toString());
        }
    }
}
